/* eslint-disable */
// global.apiurl="http://lecturerapics.myckjr.com/api/";
// global.imgurl="http://lecturerapics.myckjr.com";
import { utilJs } from '@/utils/common.js'

var href = window.location.host.indexOf(".wx.ckjr001.com") != -1 ? "wx.ckjr001.com" : window.location.host;
var map = new Map();
map.set("sdtcs.zhiku001.top", "classbe-cs7.zhiku001.top");
map.set("sdtcs3.zhiku001.top", "classbe-cs7.zhiku001.top");
map.set("formal.zhiku001.top", "classbe-sit.zhiku001.top");
map.set("kptest.ckjr001.com", "kpapi-cs.ckjr001.com");
map.set("pccs.myckjr.com", "kpapi-cs.ckjr001.com");
map.set("pccs2.myckjr.com", "kpapi-cs.ckjr001.com");
map.set("360.pc.myckjr.cn", "kpapi-cs.ckjr001.com");
map.set("360.pc.myckjr.cn", "kpapi-cs.ckjr001.com");
map.set("wxd4b449d0855310cd.test.51ckjr.com", "kpapi-cs.ckjr001.com");
map.set("kptest2.ckjr001.com", "kpapi-cs2.ckjr001.com");
map.set("kptest3.ckjr001.com", "kpapi-cs7.myckjr.com");
map.set("kptest4.ckjr001.com", "kpapi-cs4.myckjr.com");
map.set("kptest5.ckjr001.com", "kpapi-cs5.ckjr001.com");
map.set("formal.51ckjr.com", "formalapi.51ckjr.com");
map.set("formal.ckjr001.com", "formalapi.ckjr001.com");

// map.set("baijia.51ckjr.com", "kpapibaijia.51ckjr.com");
// map.set("mobile.51ckjr.com", "kpapi0.51ckjr.com");
// map.set("mobile1.51ckjr.com", "kpapi1.51ckjr.com");
// map.set("mobile2.51ckjr.com", "kpapi2.51ckjr.com");
// map.set("mobile3.51ckjr.com", "kpapi3.51ckjr.com");
// map.set("mobile4.51ckjr.com", "kpapi4.51ckjr.com");
// map.set("mobile5.51ckjr.com", "kpapi5.51ckjr.com");

map.set("mobile.lftjz.com", "kpapi1.ckjr001.com");
map.set("kp.365lft.com", "kpapi1.ckjr001.com");
map.set("365lft.com", "kpapi1.ckjr001.com");
map.set("mobile.dfyjxt.com", "kpapi1.ckjr001.com");
map.set("wx.ckjr001.com", "kpapiop.ckjr001.com");
map.set("m.hmz.cn", "kpapiop.ckjr001.com");

var apiurl = map.get(href) || 'kpapiop.ckjr001.com';
//如果是智库正式环境
if(window.location.host.includes('sdt.zhiku001.top')){
  apiurl = 'classbe.zhiku001.top';
}
//测试环境接口设置
if((href == 'kptest.ckjr001.com' || href == 'kptest2.ckjr001.com' || href == 'kptest3.ckjr001.com') && window.location.href.includes('testApiUrl')){
  let urlQuery = utilJs.parseUrlQueryParams(window.location.href);
  apiurl = urlQuery.testApiUrl;
}

if(href.includes('localhost')){
  apiurl = 'kpapi-cs.ckjr001.com';
}

global.apiurl = "https://" + apiurl + "/api/";
global.fashouApiUrl = process.env.VUE_APP_FA_SHOU_API
global.imgurl = "https://" + apiurl;
global.ckFrom = {
  'course': 5, //课程，音频视频图文
  'column': 9, //专栏
  'exam': 11, //测评
  'datum': 8, //资料
  'activity': 7, //活动
  'social': 10, //社群
  'vip': 1, //vip
  'svip': 23, //svip
  'systemPresentColumn': 24,
  'shopping': 12, //商城
  'mall': 13,
  'qa': 15, //提问
  'answer': 16, //查看答案
  'circusee': 17, // 问答围观
  'presentCourse': 25,
  'presentColumn': 26,
  'presentVip': 27,
  'presentSvip': 28,
  'collageColumn': 29,
  'collageCourse': 30,
  'collageVip': 31,
  'collageSvip': 32,
  'socailReword': 33,
  'liveReword': 35,
  'collageActivity': 36,
  'clockIn': 41, //打卡
  'agentApply': 42, // 服务商
  'partnerApply': 43, // 服务商
  'branchApply': 44, // 服务商
  'cooApply': 138, // 服务商
  'agencyApply': 139, // 服务商
  'agent6Apply': 160, // 服务商
  'agent7Apply': 161, // 服务商
  'agent8Apply': 162, // 服务商
  'agent9Apply': 163, // 服务商
  'collagePackage': 48,
  'package': 61, //知识套餐
  'presentPackage': 62, //赠送知识套餐
  'live': 51, // 直播
  'reservation': 53, //约课
  'word': 56, //词典
  'flashSalesCourse': 66,
  'flashSalesColumn': 67,
  'flashSalesVip': 68,
  'flashSalesSvip': 69,
  'flashSalesCombo': 70,
  'flashSalesExam': 71,
  'flashSalesLive': 72,
  'flashSalesPresentVip': 73,
  'flashSalesPresentSvip': 74,
  'flashSalesClockIn': 8075,
  'flashSalesCamp': 8076,
  'flashSalesSocial': 8077,
  'flashSalesReservation': 8078,
  'flashSalesVoiceTest': 8079,
  'flashSalesMutuaTest': 8080,
  'flashSalesActivity': 8081,
  'flashSalesEdu': 8082,
  'flashSalesEbooks': 8083,
  'flashSalesPrivatclass': 8084,
  'collageCamp': 9078,
  'collageSocial': 9010,
  'collageClockIn': 9041,
  'collageItemBank': 9042,
  'collageEdu': 9043,
  'collageEbooks': 9044,
  'collagePersonalLive': 9045, // 拼团 总的
  'mutuaTest': 75, //交互测评
  'mutuaTestResult': 201, //交互测评结果获取
  'form': 76, //表单
  'voiceTest': 77, //语音测评
  'camp': 78, //训练营
  'booking': 86, //预约师资
  'reReservation': 97, // 约课复训 买的是专场
  'iosCharge': 100,
  'iosVipPay': 101,
  'iosSVipPay': 102,
  'distributionColumnPay': 103,
  'distributionCollageColumn': 104,
  'video': 110,
  'voice': 111,
  'imgText': 112,
  'privateClass': 115, // 小班课
  'edu': 116, //教务系统线下课
  'eduJiGou': 118, //教务系统机构课
  'eduInviteCard': 117 ,//线下课邀请卡
  'collageLive': 124,
  'testpPaper': 125, //测评考试
  'collagePrivateClass': 126,
  'itemBank': 129,//练习
  'ebooks': 142, //电子书
  'circle': 181, //圈子
  'circleTheme': 185, //主题圈子
  'presentEbooks': 145, //赠送电子书
  'presentCamp': 146, //赠送训练营
  'notice': 170, //预告
  'shopComment': 155, //商城评价
  'task': 137, // 好友灌溉
  'coupon': 92, // 优惠券
  'collage': 121, // 拼团 总的
  'agentRenew': 167, // 服务商续费
  'personalLive': 180, // 拼团 总的
  'seatFee': 187, //约课支持席位费
  'shareholder': 183, //升级股东
  'giftCard': 190, // 虚拟充值
  'shareholderPayVoucher': 200, //股东付费抵用券
  'valuableCoupon': 5000, //有价券
  'collocationBuy': 197, // 搭配购
  'Article': 199 // 店铺文章
};
global.relationTypeMap = {//营销类型
  'flashSales': 1, //限时购
  'collage': 2, //拼团
  'coupon': 7, //优惠券
  'shareholderCoupon': 20 //股东优惠券
};
global.prodMapType = {
  1: 'VIP',
  2: 'VIP',
  3: 'VIP2',
  4: 'svip',
  5: '课程',
  6: '分类',
  7: '活动',
  8: '资料',
  9: '专栏',
  10: '社群',
  11: '测评',
  12: '商城',
  13: '独立商城',
  15: '问答',
  16: '付费问答',
  17: '问答围观',
  20: '余额利息',
  22: 'VIP2',
  23: 'SVIP',
  24: '赠送专栏',
  25: '赠送课程',
  26: '赠送专栏',
  27: '赠送VIP',
  28: '赠送SVIP',
  29: '拼团专栏',
  30: '拼团课程',
  31: '拼团VIP',
  32: '拼团SVIP',
  33: '社群打赏',
  35: '直播打赏',
  37: '代理商赠送（兑换码兑换）课程',
  38: '代理商赠送（兑换码兑换）专栏',
  41: '打卡',
  42: '服务商',
  43: '服务商',
  44: '服务商',
  48: '拼团知识套餐',
  138: '服务商',
  139: '服务商',
  160: '服务商',
  161: '服务商',
  162: '服务商',
  163: '服务商',
  51: '公开课',
  53: '约课',
  56: '词典',
  61: '知识套餐',
  62: '买赠知识套餐',
  66: '限时购课程',
  67: '限时购专栏',
  68: '限时购VIP',
  69: '限时购SVIP',
  70: '限时购知识套餐',
  71: '限时购测评',
  72: '限时购直播',
  73: '买赠VIP(限时购)',
  74: '买赠SVIP(限时购)',
  75: '互动测评',
  76: '表单',
  77: 'AI.测评',
  78: '训练营',
  86: '预约',
  91: '代理商赠送（兑换码兑换）训练营',
  97: '复训费',
  100: '充值余额',
  103: '内容市场',
  104: '内容拼团',
  110: '视频',
  111: '音频',
  112: '图文',
  115: '小班课',
  116: '面授课',
  125: '考试',
  129: '练习',
  138: '服务商',
  139: '服务商',
  142: '电子书',
  145: '赠送电子书',
  146: '赠送训练营',
  178: '投票赠礼',
  180: '直播间',
  181: '圈子',
  183: '升级股东',
  185: '主题圈子',
  187: '席位费',
  190: '虚拟币',
  197: '搭配购',
  199: '店铺文章',
  200: '抵用券',
  201: '互动测评',//互动测评购买查看结果
  8083: '限时购电子书',
  8084: '限时购小班直播',
  9044: '拼团电子书',
  5000: '有价优惠券'
};
global.prodCourseType = {
  0: '视频',
  1: '音频',
  2: '图文',
};
global.THEME_RGB_MAP = {
  'mb5_default': '255, 113, 0',
  'mb4_default': '255, 48, 12',
  'mb3_orange': '255,93,61',
  'mb3_blue': '36,138,253',
  'mb3_ruby': '214,8,8',
  'mb3_green': '48,182,86',
  'mb3_blown': '151,104,0',
  'mb3_pink': '247,65,99',
  'mb3_purple': '110,65,242',
  'mb3_darkBlue': '64,101,150',
  'mb3_black': '51,51,51',
  'mb3_yellow': '255,147,2',
  'mb3_tinyGreen': '101,196,170',
  'mb6_default': '36, 138, 253',
  'mb7_blue': '36,138,253',
  'mb7_drakBlue': '64,101,150',
  'mb7_orange': '255,147,2',
  'mb7_purple': '110,65,242',
  'mb7_pink': '247,65,99',
  'mb7_blown': '151,104,0',
  'mb7_black': '51,51,51',
  'mb7_green': '48,182,86',
  'mb7_ruby': '214,8,8',
  'mb7_yellow': '255,147,2',
  'mb7_tinyGreen': '101,196,170',
  'mb8_blue': '22, 150, 255',
  'mb8_drakBlue': '57,63,81',
  'mb8_orange': '239,124,56',
  'mb8_purple': '110,65,242',
  'mb8_pink': '247,65,99',
  'mb8_blown': '151,104,0',
  'mb8_black': '51,51,51',
  'mb8_green': '48,182,86',
  'mb8_ruby': '214,8,8'
};
global.marketThemeBg = {
  'mk_red': ['#FF0400', '#FF4C24'],
  'mk_orange ': ['#FF4200', '#FF8D00'],
  'mk_pink': ['#FF055A', '#FF1D95'],
  'mk_green': ['#00A523', '#00DD33'],
  'mk_purple': ['#5B00D5', '#9B00FF'],
  'mk_blue': ['#0038FF', '#008AFF'],
}
global.moduleTypeMap = {
  '42': 'iosGzhPayAgent', //服务商
  '43': 'iosGzhPayAgent', //服务商
  '44': 'iosGzhPayAgent', //服务商
  '9': 'iosGzhPayColumn', //专栏
  '26': 'iosGzhPayColumn', //买赠专栏
  '29': 'iosGzhPayColumn', //拼团购专栏
  '67': 'iosGzhPayColumn', //限时购专栏
  '61': 'iosGzhPayCombo', //知识套餐
  '48': 'iosGzhPayCombo', //拼团知识套餐
  '62': 'iosGzhPayCombo', //拼团知识套餐
  '70': 'iosGzhPayCombo', //限时购知识套餐
  '5': 'iosGzhPayCourse', //课程
  '25': 'iosGzhPayCourse', //买赠课程
  '30': 'iosGzhPayCourse', //拼团课程
  '66': 'iosGzhPayCourse', //限时购课程
  '8': 'iosGzhPayDatum', //资料
  '56': 'iosGzhPayDict', //词典
  '103': 'iosGzhPayDistMkt', //内容分销
  '104': 'iosGzhPayDistMkt', //内容分销
  '11': 'iosGzhPayExam', //测评
  '71': 'iosGzhPayExam', //测评
  '51': 'iosGzhPayLive', //直播
  '72': 'iosGzhPayLive', //直播
  '1': 'iosGzhPayMember', //会员
  '23': 'iosGzhPayMember', //会员
  '27': 'iosGzhPayMember', //会员
  '28': 'iosGzhPayMember', //会员
  '31': 'iosGzhPayMember', //会员
  '32': 'iosGzhPayMember', //会员
  '68': 'iosGzhPayMember', //会员
  '69': 'iosGzhPayMember', //会员
  '75': 'iosGzhPayMutualTest', //交互测评
  '8080': 'iosGzhPayMutualTest', //限时购交互测评
  '115': 'iosGzhPayPrivateClass', //小班课
  '15': 'iosGzhPayQuestion', //问答
  '41': 'iosGzhPaySignCard', //打卡
  '8075': 'iosGzhPaySignCard', //限时购打卡
  '10': 'iosGzhPaySocial', //社群
  '8077': 'iosGzhPaySocial', //限时购社群
  '77': 'iosGzhPaySpeech', //语音测评
  '8079': 'iosGzhPaySpeech', //限时购语音测评
  '78': 'iosGzhPayTraining', //训练营
  '8076': 'iosGzhPayTraining', //限时购训练营
  '5000': 'iosGzhPayValuableCoupon', //有价券
};
global.navMap = {
  agent: {
    icon: "&#xe7d6;",
    link: "/homePage/agent/agentIndex"
  },
  column: {
    icon: "&#xe7cf;",
    link: "/homePage/column/columnList"
  },
  online: {
    icon: "&#xe7d8;",
    link: "/homePage/course/courseList"
  },
  addTeacher: {
    icon:
      localStorage.getItem("companyId") == "ldwk"
        ? "&#xe7da;"
        : "&#xe7da;",
    link: ""
  },
  history: {
    icon: "&#xe7dd;",
    link: "/member/watchList/watchList?ckFrom=" + global.ckFrom.course
  },
  mall2: {
    icon: "&#xe7df;",
    link: "/mall/mallIndex"
  },
  gzhShow: {
    icon: "&#xe7d0;",
    link: ""
  },
  upgradeVip: {
    icon: "&#xe7d7;",
    link: "/member/vip/vipUp"
  },
  spread: {
    icon: "&#xe8a9;",
    link: "/homePage/spread/SpreadMoney"
  },
  activity: {
    icon: "&#xe7de;",
    link: "/activity/activityIndex"
  },
  examTopic: {
    icon: "&#xe7e1;",
    link: "/homePage/examination/examinationList"
  },
  datum: {
    icon: "&#xe7e0;",
    link: "/homePage/datum/datumList"
  },
  social: {
    icon: "&#xe7db;",
    link: "/homePage/socialGroup/socialGroupList"
  },
  question: {
    icon: "&#xe7b7;",
    link: "/homePage/qa/answerLord"
  },
  category: {
    icon: "&#xe7d4;",
    link: "/homePage/course/courseCategory"
  },
  televiseLive: {
    icon: "&#xe7f9;",
    link: "/homePage/live/liveList"
  },
  signCard: {
    icon: "&#xe81c;",
    link: "/homePage/clockIn/clockInList"
  },
  reservation: {
    icon: "&#xe854;",
    link: "/homePage/reservation/reservationList"
  },
  dictionary: {
    icon: "&#xe877;",
    color: "#FF5B50",
    link: "/homePage/word/wordList",
    // navText: "词典"
  },
  daySign: {
    icon: "&#xe903;",
    color: "#5491ff",
    link: "/member/myIntegral/integralIndex",
    navText: "日历签到"
  },
  appointment: {
    icon: "&#xe8d0;",
    link: "/homePage/booking/bookingList",
    navText: "预约"
  },
  privateClass: {
    icon: "&#xe90a;",
    link: "/homePage/privateClass/classList",
    navText: "小班课"
  },
  microMall: {
    icon: "&#xe925;",
    link: "",
    navText: "微页面"
  },
  mallNewProduct: {
    icon: "&#xe92f;",
    link: "/mall/classification/newAndHot?Type=NEW",
    navText: "新品"
  },
  mallHotsale: {
    icon: "&#xe931;",
    link: "/mall/classification/newAndHot?Type=HOT",
    navText: "热卖"
  },
  mallOrder: {
    icon: "&#xe92e;",
    link: "/member/myOrder/allOrderList?fromOrderType=2",
    navText: "订单"
  },
  educationSystem: {
    icon: "&#xe90d;",
    link: "/edu/eduList",
    navText: "面授课"
  },
  mallAll: {
    icon: "&#xe942;",
    link: "/mall/classification/classificationAll?cId=0",
    navText: "全部"
  },
  custom: { // 自定义
    icon: "&#xe65b;",
    link: "",
    navText: '自定义'
  },
  liveRoom: {
    icon: "&#xe653;",
    link: "/homePage/live/livePersonalList"
  },
  circle: {
    icon: "&#xe6ff;",
    link: "/homePage/circle/circleList",
    navText: "圈子"
  },
  promotedAccountList: {
    icon: "&#xe7cd;",
    link: "/homePage/agent/promotedAccountList",
    navText: "推广列表"
  },
  studyCenter: {
    icon: "&#xe63e;",
    link: "/member/watchList/learnCenter",
    navText: "学习中心"
  },
  linkToMiniProgram: {
    icon: "&#xe7ee;",
  }
};
global.QINIU_UPLOAD_URL = "https://upload.qiniup.com/";
global.QINIU_DISPLAY_URL = "https://qnoss.ckjr001.com/";
  //1. 购买VIP; 5. 购买课程;  7. 活动付费; 8. 资料购买; 9. 购买栏目; 10. 社群购买;23.购买SVIP;
  //24:系统赠送专栏 11. 购买测评; 12.商城邀请卡 13. 独立商城; 26.专栏赠送；25.课程赠送；27.赠送vip，28.赠送svip,
  //29:拼团专栏  ,30:拼团课程,  31:拼团vip  ,32:拼团sVip,33：社群打赏，35：直播打赏，36:拼团活动,41：打卡购买，  53 约课购买,
  //56:词典
  //61知识套餐,78训练营,101 iosvip的购买,100:ios充值,103：分销商城购买，104：分销拼团
  // 66 限时购课程 67 限时购专栏 68 限时购VIP 69 限时购svip 70 限时购知识套餐 71 限时购测评 72 限时购直播

  //IOS12数组reverse bug问题临时修复方法 creatBy 小柯
  (function () {
    if (typeof weex !== 'undefined') {
      if (weex.config.env.osName !== 'iOS') return;
      if (weex.config.env.osVersion.indexOf('12') !== 0) return;
    } else {
      var ua = navigator.userAgent;
      if (!ua.match(/(iPhone|iPad|iPod)/)) return;
      var matched = ua.match(/OS ([\d_\.]+) like Mac OS X/);
      if (!matched || !matched[1]) return;
      if (matched[1].indexOf('12') !== 0) return;
    }
    Array.prototype._reverse = Array.prototype.reverse;
    Array.prototype.reverse = function reverse() {
      if (Array.isArray(this)) this.length = this.length;
      return Array.prototype._reverse.call(this);
    }
    var nonenum = { enumerable: false };
    Object.defineProperties(Array.prototype, {
      _reverse: nonenum,
      reverse: nonenum,
    });
  })();
